#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Time    : 2025/4/21 16:17
@Author  : HZP
@File    : 1.StrOutputParser使用技巧.py
"""
from dotenv import load_dotenv
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI

load_dotenv()

chat_prompt_template = ChatPromptTemplate.from_template("{query}")

llm = ChatOpenAI(
    temperature=0.6,
    model="deepseek-r1:70b"
)

str_output_parse = StrOutputParser()

content = str_output_parse.invoke(llm.invoke(chat_prompt_template.invoke({"query": "你好，你是?"})))

print(content)
